﻿using BestCode.Creds.Entities;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace BestCode.Creds.Data.Mappings
{
    public class EntityChildMapping : ClassMapping<EntityChild>
    {
        public EntityChildMapping()
        {
            Table("EntityChild");
            Id(p => p.Id, map =>
            {
                map.Column("EntityChildId");
                map.Generator(Generators.Identity);
            });
            
            Property(p => p.Name);
            Property(p => p.PicturesFolder);
            Property(p => p.CredentialCost);

            ManyToOne(p => p.Entity, map => map.Column("EntityId"));
        } 
    }
}
